# models.py in 'video_records' app
from django.db import models

class VideoRecord(models.Model):
    video_id = models.AutoField(primary_key=True)
    timestamp = models.DateTimeField()
    storage_path = models.CharField(max_length=500)
    device = models.ForeignKey('devices.Device', on_delete=models.CASCADE)

    def __str__(self):
        return f"Video {self.video_id} from Device {self.device.device_name}"
    
    class Meta:
        db_table = 'video_records'  # 自定义数据库表名
